import java.util.*;

public class Main{
    
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        String A = sc.nextLine();
        String B = sc.nextLine();
        int count = 0;  //表示回文串个数
        if(palindrome(B+A)) count++;  //头
        if(palindrome(A+B)) count++;  //尾
        //插入中间
        for(int i = 1; i < A.length(); i++){
            if(palindrome(A.substring(0,i)+B+A.substring(i))){
                count++;
            }
        }
        System.out.println(count);
        
        
    }
    
    //判断回文串
    public static boolean palindrome(String str){
        char[] array = str.toCharArray();
        int i = 0;
        int j = array.length - 1;
        while(i < j){
            if(array[i] != array[j]){
                return false;
            }
            i++;
            j--;
        }
        return true;
    }
}